from django.views import View
from django.http import JsonResponse

class Login(View):
    def get(self,request):
        print("xxxx")
        return JsonResponse({
            'code':200,
            'msg':'成功'
        })

    def post(self,request):

        return JsonResponse({
            'code':200,
            'msg':"登录成功"
        })


class Goods(View):
    def get(self,request):

        data = [
            {
                'id':1,
                'name':"鱼香肉丝",
                'price':15,
                'num':1,
            },
            {
                'id':2,
                'name':"西红柿鸡蛋",
                'price':12,
                'num':1,
            },{
                'id':3,
                'name':"宫保鸡丁",
                'price':18,
                'num':1,
            },{
                'id':4,
                'name':"红烧肉",
                'price':35,
                'num':1,
            }
        ]
        return JsonResponse({
            'code':200,
            'data':data,
        })